<template>
  <!-- /.navbar -->

  <header id="head" class="secondary" style="height: 1px;min-height: 1px">
  </header>


  <!-- container -->
  <div class="container">
    <div class="row">
      <section class="w3l-workinghny-form">
        <!-- /form -->
        <div class="workinghny-form-grid">
          <div class="wrapper">
            <div class="logo">
              <h1><a class="brand-logo"><span>Working</span> Sign In</a></h1>
              <!-- if logo is image enable this
                  <a class="brand-logo" href="#index.html">
                      <img src="image-path" alt="Your logo" title="Your logo" style="height:35px;" />
                  </a> -->
            </div>
            <div class="workinghny-block-grid">
              <div class="workinghny-left-img align-end">
                <img src="/statiLog/images/2.png" class="img-responsive" alt="img"/>
              </div>
              <div class="form-right-inf">

                <div class="login-form-content">
                  <h2>Where to?</h2>
                  <form action="#" class="signin-form" method="post">
                    <div class="one-frm">

                      <label>Name</label>
                      <input @keyup.enter="login" type="text" v-model="username" name="Name" placeholder="" required="">
                    </div>
                    <div class="one-frm">
                      <label>Password</label>
                      <input @keyup.enter="login" type="password" v-model="password" name="Password" placeholder="" required="">
                    </div>
                    <label class="check-remaind">
                      <input @keyup.enter="login" v-model="remember" type="checkbox">
                      <span class="checkmark"></span>
                      <p class="remember">Remember Me</p>

                    </label>
                    <p @keyup.enter="login()" @click="login()" class="btn btn-style mt-3">Sign In</p>
                    <p class="already">Don't have an account? <a>Sign Up</a></p>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- //form -->
        <!-- copyright-->
        <div class="copyright text-center">
          <div class="wrapper">
            <p class="copy-footer-29">© 2020 Working Sign In. All rights reserved | Design by <a
                href="https://w3layouts.com">W3layouts</a></p>
          </div>
        </div>
        <!-- //copyright-->
      </section>
    </div>
  </div>
  <!-- /container -->
</template>

<script>
import axios from "axios";
import $store from "../store/index";
export default {
  name: "sign",
  data(){
    return{
      username:'',
      password:'',
      remember:false
    }
  },
  methods: {
    login() {
      axios.post("/api/open/StudentLogin", {
        UserName: this.username,
        Password: this.password,
        Rem: this.remember
      }).then((res)=>{
        if (res.status===200){
          window.localStorage.setItem("zjxClass_student_info",JSON.stringify(res.data))
          this.$store.commit('setLoged',true)
          this.$router.push({path:"/"})
          this.setLoged(true)
        }
      })
    }
  }
}
</script>

<style scoped>

</style>